<?php

require_once 'Configuration.php';

session_start();

define("DS", DIRECTORY_SEPARATOR);

define("APP_ROOT", $_SERVER["DOCUMENT_ROOT"] . DS . "ilMioTorneo");
define("APP_UTILS", APP_ROOT . DS . "utils");
define("APP_PERSISTENCE", APP_ROOT . DS . "persistence");
define("APP_DAO", APP_PERSISTENCE . DS . "dao");
define("APP_ENTITY", APP_PERSISTENCE . DS . "entity");
define("APP_BL", APP_ROOT . DS . "bl");
define("APP_FE", APP_ROOT . DS . "fe");

class ConfigurationFactory {

    private static $conf = null;

    function __construct() {
        self::$conf = new JConfig();
    }

    static function getInstance() {
        if (self::$conf == null) {

            if (isset($_SESSION['conf'])) {
                self::$conf = $_SESSION['conf'];
            } else {
                new ConfigurationFactory();
                $_SESSION['single'] = ConfigurationFactory::$conf;
            }
        }
        return self::$conf;
    }

}

?>
